﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Xts
{
    namespace XInterBank
    {
        namespace Strategy
        {
            public class InterBankTradingCallback
            {
                private InterBankStrategyScriptBase x_strategyScript;

                public InterBankTradingCallback(InterBankStrategyScriptBase strategyScript)
                {
                    x_strategyScript = strategyScript;
                }

                public void BoundSnapshotHandler(ref MarketData.XSnapshotDataEventHandler handler)
                {
                    handler.SnapshotReached += new EventHandler<MarketData.XSnapshotDataEventArgs>(OnNewSnapshot);
                }

                public void BoundQuoteDetailDataHandler(ref MarketData.XQuoteDetailDataEventHandler handler)
                {
                    handler.QuoteDetailReached += new EventHandler<MarketData.XQuoteDetailDataEventArgs>(OnNewQuoteDetailData);
                }

                //快照行情数据推送
                public void OnNewSnapshot(object sender, MarketData.XSnapshotDataEventArgs args) 
                {
                    x_strategyScript.OnNewSnapshot(args.Snapshot);
                }

                //报价明细行情数据推送
                public void OnNewQuoteDetailData(object sender, MarketData.XQuoteDetailDataEventArgs args) 
                {
                    x_strategyScript.OnNewQuoteDetailData(args.QuoteDetail);
                }

                //普通委托信息推送
                public void OrderInfoNortify(object sender, TradingClient.XBondOrderInfoEventArgs args) 
                {
                    x_strategyScript.OrderInfoNortify(args.OrderInfo);
                }

                //普通委托成交推送		
                public void OrderFillNortify(object sender, TradingClient.XBondOrderFillEventArgs args) 
                {
                    x_strategyScript.OrderFillNortify(args.OrderFill);
                }

                //做市委托信息推送	
                public void MarketMakingOrderInfoNortify(object sender, TradingClient.XBondMarketMakingOrderInfoEventArgs args) 
                {
                    x_strategyScript.MarketMakingOrderInfoNortify(args.OrderInfo);
                }

                //做市委托成交推送
                public void MarketMakingOrderFillNortify(TradingClient.XBondOrderFillEventArgs args) 
                {
                    x_strategyScript.MarketMakingOrderFillNortify(args.OrderFill);
                }

                //查询委托信息回调
                public void OnQueryOrderInfo(object sender, TradingClient.XBondOrderInfoQueryRspEventArgs args)
                {
                    x_strategyScript.OnQueryOrderInfo(args.Rsp, args.Cookies);
                }

                //查询委托信息失败回调
                public void OnFailureQueryOrderInfo(object sender, TradingClient.XBondOrderInfoQueryCookiesEventArgs args) 
                {
                    x_strategyScript.OnFailureQueryOrderInfo(args.Cookies);
                }

                //批量查询委托信息回调
                public void OnBatchQueryOrderInfo(object sender, TradingClient.XBatchBondOrderInfoQueryRspEventArgs args)
                {
                    x_strategyScript.OnBatchQueryOrderInfo(args.Rsp, args.Cookies);
                }

                //批量查询委托信息失败回调
                public void OnFailureBatchQueryOrderInfo(object sender, TradingClient.XBatchBondOrderInfoQueryCookiesEventArgs args) 
                {
                    x_strategyScript.OnFailureBatchQueryOrderInfo(args.Cookies);
                }

                //查询成交回报回调
                public void OnQueryOrderFill(object sender, TradingClient.XBondOrderFillQueryRspEventArgs args) 
                {
                    x_strategyScript.OnQueryOrderFill(args.Rsp, args.Cookies);
                }

                //查询成交回报失败回调
                public void OnFailureQueryOrderFill(object sender, TradingClient.XBondOrderFillQueryCookiesEventArgs args) 
                {
                    x_strategyScript.OnFailureQueryOrderFill(args.Cookies);
                }

                //批量查询成交回报回调
                public void OnBatchQueryOrderFill(object sender, TradingClient.XBatchBondOrderFillQueryRspEventArgs args)
                {
                    x_strategyScript.OnBatchQueryOrderFill(args.Rsp, args.Cookies);
                }

                //批量查询成交回报失败回调
                public void OnFailureBatchQueryOrderFill(object sender, TradingClient.XBatchBondOrderFillQueryCookiesEventArgs args) 
                {
                    x_strategyScript.OnFailureBatchQueryOrderFill(args.Cookies);
                }

                //发送普通委托回调
                public void OnSendOrder(object sender, TradingClient.XSendOrderRspEventArgs args) 
                {
                    x_strategyScript.OnSendOrder(args.Rsp, args.Cookies);
                }

                //发送普通委托失败回调
                public void OnFailureSendOrder(object sender, TradingClient.XSendOrderCookiesEventArgs args) 
                {
                    x_strategyScript.OnFailureSendOrder(args.Cookies);
                }

                //发送做市委托回调
                public void OnSendMarketMakingOrder(object sender, TradingClient.XSendOrderRspEventArgs args) 
                {
                    x_strategyScript.OnSendMarketMakingOrder(args.Rsp, args.Cookies);
                }

                //发送做市委托失败回调
                public void OnFailureSendMarketMakingOrder(object sender, TradingClient.XSendOrderCookiesEventArgs args) 
                {
                    x_strategyScript.OnFailureSendMarketMakingOrder(args.Cookies);
                }

                //委托撤单回调
                public void OnCancelOrder(object sender, TradingClient.XCancelOrderRspEventArgs args) 
                {
                    x_strategyScript.OnCancelOrder(args.Rsp, args.Cookies);
                }

                //委托撤单失败回调
                public void OnFailureCancelOrder(object sender, TradingClient.XCancelOrderCookiesEventArgs args)
                {
                    x_strategyScript.OnFailureCancelOrder(args.Cookies);
                }

                //委托批量撤单回调
                public void OnBatchCancelOrder(object sender, TradingClient.XBatchCancelOrderRspEventArgs args) 
                {
                    x_strategyScript.OnBatchCancelOrder(args.Rsp, args.Cookies);
                }

                //委托批量撤单失败回调
                public void OnFailureBatchCancelOrder(object sender, TradingClient.XBatchCancelOrderCookiesEventArgs args) 
                {
                    x_strategyScript.OnFailureBatchCancelOrder(args.Cookies);
                }

            }
        }
    }
    
}
